Skip to content

Conversation

@Mahtem
Copy link

@Mahtem Mahtem commented Oct 24, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Completed course works of Sprint 2 from module structuring and testing data

Questions

Questions and blockers will be forwarded to slack.

@Mahtem Mahtem added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. and removed Module-Structuring-And-Testing-Data The name of the module. labels Oct 24, 2025
suffix = "am";
}

hours = hours % 12 || 12; // convert 0 to 12, 13 to 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how the expression hours % 12 || 12 convert 0 to 12 and 13 to 1?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how the expression hours % 12 || 12 convert 0 to 12 and 13 to 1?

The expression converts 0 to 12, 13 to 1 and soon as it returns the remainder
for eg. taking 12/12 the remainder is 0
similarly if 13 is taken 13/12 , the remainder is 1, the operator || helps us to return the remainder after
a division operation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My previous question might not be very clear. This is what I would like to find out:

Suppose expr1 and expr2 are some JavaScript expressions.
Can you explain how the expression expr1 || expr2 is evaluated in JavaScript?


// Modified Code:

function formatAs12HourClock(time) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another function with the same name defined on lines 6-12. Do you still need that function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another function with the same name defined on lines 6-12. Do you still need that function?

Thank you, I do not need that function, I have commented it out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep our code clean (as a best practice), it is better to delete the code we no longer need. Should we ever need to recover the code, we can always find them in one of the commits we made.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 25, 2025
@Mahtem Mahtem added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 13, 2025
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants